<%@page extends="pages.PlayerController"%>
<% addContent("title","List Players");%>
    <div><span class="title">Team Roster</span> <span class="title_action">(<a href="newPlayer.jsp">new player</a>)</span></div>
    <br/>
    
<span><%=h(getFlash("notice"))%></span>
<br/>
    <table>
        <thead>
            <tr>
                <th>First Name</th>
                <th>Last Name</th>
                <th>Position</th>
                <th>Age</th>
                <th>&nbsp;</th>
            </tr>
        </thead>
        <tbody>
     
<%for(int i=0;i < players.size();i++){%>
    <tr>
        <td><%= players.get(i).getFirstName()%></td>
        <td><%= players.get(i).getLastName()%></td>
        <td><%= players.get(i).getPosition()%></td>
        <td><%= players.get(i).getAge() %></td>
        <td><a href="show.jsp?id=<%= players.get(i).getId()%>">show</a>&nbsp;|&nbsp;
        <a href="edit.jsp?id=<%= players.get(i).getId()%>">edit</a>&nbsp;|&nbsp;
        <a href="list.jsp" onclick="document.forms['player_<%= players.get(i).getId()%>'].submit();return false;">delete</a>
        <form method="post" name="player_<%=players.get(i).getId()%>" id =player_<%=players.get(i).getId()%>">
            <input type="hidden" name="exe" value="delete"/>
            <input type="hidden" name="id" value="<%= players.get(i).getId()%>"/>
        </form></td>
    </tr>
<% } %>  
            
        </tbody>
    </table>